<%--
  Created by IntelliJ IDEA.
  User: Chris
  Date: 2021/5/8
  Time: 14:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>

<body>
欢迎进入设备管理系统的注册界面<br>
<script type="text/javascript">
    function validate(){
        if(registerForm.account.value==""){
            alert("账号不能为空!");
            return;
        }
        if(registerForm.password.value==""){
            alert("密码不能为空!");
            return;
        }
        if(registerForm.password.value != registerForm.password_2.value){
            alert("密码不一致！");
            return;
        }
        if (registerForm.authority.value == "1" && registerForm.secret.value != "gdpu"){
            alert("管理员密匙有误!!")
            return;
        }
        if (registerForm.authority.value == "1" && registerForm.secret.value == ""){
            alert("管理员密匙为空!")
            return;
        }
        registerForm.submit();
    }
</script>
<form name="registerForm" action="servlet/RegisterServlet" method="post">
    请您输入账号：<input name="account" type="text"><BR>
    请您输入密码：<input name="password" type="password"><BR>
    请再输入密码：<input name="password_2" type="password"><BR>
    <input type="radio" name = "authority" checked value="1">管理员
    <input type="radio" name = "authority" value="2">普通用户<br>
    若是进行管理员注册需要密匙，若是普通用户注册不需要密匙，密匙请咨询终极管理员。<br>
    密匙<input type="text" name = "secret">
    <input type="button" value="注册" onclick="validate()">
    <a href="index.jsp">返回登录界面</a>
</form>
</body>
</html>
